PROGRAM main
  VAR
    // 报警标志位
    bAlarmFlag AT %IX0.1 : BOOL;
    // 消音按钮
    bSilenceButton AT %IX0.2 : BOOL;
    // 报警灯
    bAlarmLight AT %QX0.0 : BOOL;
    // 报警喇叭
    bAlarmSpeaker AT %QX0.1 : BOOL;
    // 消音定时器
    aTOF : TOF;
    // 消音时间
    tSilenceTime : TIME := T#30s;
  END_VAR

bAlarmLight := bAlarmFlag;
bAlarmSpeaker := bAlarmFlag AND NOT aTOF.Q;
aTOF(IN := bAlarmFlag AND bSilenceButton, PT := tSilenceTime);
END_PROGRAM
